package com.mccrea.pattern.expression;

/**
 * @Classname NonTerminalExpression
 * @Description 非终结符表达式类
 * @Date 2021/5/24 0024 14:32
 * @Created by Mccrea_Gao
 */
public class NonTerminalExpression implements AbstractExpression{

    private AbstractExpression city;

    private AbstractExpression person;

    public NonTerminalExpression(AbstractExpression city, AbstractExpression person) {
        this.city = city;
        this.person = person;
    }

    @Override
    public boolean interpret(String info) {
        String[] infos = info.split("的");
        return city.interpret(infos[0]) && person.interpret(infos[1]);
    }
}
